﻿using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WpfByToolKit.ViewModel
{
	public class Locator
	{
		public static IServiceProvider? ServiceProvide { get; set; }

		public Locator()
		{
			ServiceProvide = GetService();
		}
		private IServiceProvider GetService()
		{
			var service = new ServiceCollection();
			service.AddSingleton<MainWindowViewModel>();
			return service.BuildServiceProvider();
		}
		public MainWindowViewModel MainWindowViewModel
		{
			get
			{
				return ServiceProvide.GetService<MainWindowViewModel>();
			}
		}
	}
}
